<template>
  <div class="nav_outer">
    <Header tooltext="删除" @herttool="del">{{detail.type==1?'加班详情':'请假详情'}}</Header>
    <div class="content">
      <div class="edits">
        <div class="edit">
          <div class="edit_title">{{detail.type==1?'加班时长':'请假时长'}}</div>
          <div class="edit_conten">
            <span>{{detail.overTime}}</span>
          </div>
        </div>
        <div class="edit">
          <div class="edit_title">班次类别</div>
          <div class="edit_conten">
            <span>{{detail.tagName}}</span>
          </div>
        </div>
        <div class="edit">
          <div class="edit_title">{{detail.type==1?'加班倍数':'请假类别'}}</div>
          <div class="edit_conten">
            <span>{{detail.type==1? detail.salaryMultiple : detail.leaveTypeName}}</span>
          </div>
        </div>
        <div class="edit">
          <div class="edit_title">备注</div>
          <div class="edit_conten">
            <span>{{detail.remarks}}</span>
          </div>
        </div>
      </div>

      <div class="goedit" @click="goedit">去修改</div>
    </div>
    <div class="bg" style="position:absolute;width:100%;left:0;top:0;bottom:0;background:#fff;z-index:-1;"></div>
  </div>
</template>

<script>
import Header from "@/components/commonComponents/Header";
export default {
  data() {
    return {   
      detail:{},
      eid: ""
    };
  },
  created() {
    this.eid = this.$route.params.id;
    this.loadDetail();
  },
  mounted() {
  },
  methods: {
    loadDetail() {
      this.Http.get(`/yzj/app/over_time/${this.eid}`, null).then(res => {
        this.detail = res;
      });
    },
    del() {
      this.Http.delete(`yzj/app/over_time/${this.eid}`, null).then(res => {
        this.$router.back();
      });
    },
    goedit(){
      if(this.detail.type==1){
        this.$router.replace('/addovertime?id='+this.eid);
      }else{
        this.$router.replace('/addleave?id='+this.eid);
      }
    }
  },
  components: {
    Header
  }
};
</script>

<style scoped lang='scss'>
@function px2em($px) {
  @if (unitless($px)) {
    @return px2em($px + 0px);
  } @else if (unit($px) == em) {
    @return $px;
  }
  @return ($px / 75px) * 1rem;
}
body {
  background: #f5f5f5 !important;
}
.content {
  color: #666;
  background: #fff;
  padding-bottom: 5px;
  width: 100%;
  .edits{
    padding: px2em(20);
  }
  .edit {
    border-bottom: 1px solid #ddd;
    display: flex;
    align-items: center;
    padding: px2em(16) px2em(28);
    .edit_conten {
      flex: 1;
      margin-left: 15px;
      text-align: right;
    }
    input {
      text-align: right;
      color: #333;
      font-size: 0.9em;
      padding-right: 0;
      &::-webkit-input-placeholder {
        color: #999;
      }
    }
  }
  .goedit{
    margin: 15px 30px;
    height: px2em(80);
    border-radius: px2em(40);
    line-height: px2em(80);
    color: #fff;
    background: #ccc;
    text-align: center;
    background: #5681f3;
  }
}
</style>